<script setup>
import { getHotAPI } from "@/apis/home";
import { ref } from 'vue'
import { onMounted } from 'vue'
const hotList=ref([])
const getHot=async()=>{
  const res=await getHotAPI()
  hotList.value=res.result
  console.log(res.result)
}
onMounted(()=>{
  getHot()
})
</script>
<template>
  <div class="total">
  <div class="title">
<h1>人气推荐</h1>
<h4>人气推荐，不容错过</h4>
  </div>
  <div class="boxes">
    <div class="box" v-for="(item,index) in hotList">
      <router-link :to="'/detail/'+item.id">
      <img :src="item.picture" alt="">
      <p>{{ item.title }}</p>
      <p>{{ item.alt}}</p>
    </router-link>
    </div>


  </div>
</div>
</template>
<style>
.total{
  width: 60%;
  margin-left: 20%;
  background-color: antiquewhite;
  height: 400px;
}
.title{
  background-color: aliceblue;
  margin-top: 20px;
  width: 100%;
  height: 20%;
}
.title h1{
  display: inline-block;
}
.title h4{
  display: inline-block;
  margin-left: 20px;
}
.boxes{
  background-color: aqua;
  width: 100%;
  height: 80%;
  justify-content: space-between;
  display: flex;
}
.box{
  background-color: antiquewhite;
  width: 25%;
  height: 100%;
}

</style>